<style lang='less' scoped>
	@import '~style/filter.less';

</style>

<template>
	<div>
		<div class="filterForm">
				
			<div class="filterContBox">
				<div class="filterLabel">标题</div>
				<el-input 
				size="small"
				v-model.trim="filterObj.keyword" 
				placeholder="请输入标题"
				class="filterInput"
				></el-input>
			</div>
			
			<div class="filterContBox">
				<span class="filterLabel">发布时间</span>
				<el-date-picker
					size="small"
					v-model="createionTimeArr"
					@change="setDaterange"
					type="daterange"
					placeholder="选择日期范围">
				</el-date-picker>
			</div>
		</div>
		<div class="filterButton">
					
			<el-button type="warning" class="btn" @click='getListData()' v-if='getButtonConfig && getButtonConfig.query'>查询</el-button>
			<el-button type="warning" class="btn" @click='goPage("addNewNotice")' v-if='getButtonConfig && getButtonConfig.create'>
					发布公告
			</el-button>
		</div>
	</div>
</template>

<script>
	import {postCouponList as getCouponList} from 'api/coupon/index.js'

	export default {
		props:['issuerList', 'getButtonConfig'],
		components:{
		},
		data(){
			return{
				createionTimeArr:'',
				filterObj:{
					keyword:'',
					dateStart:'',
					dateEnd:'',
				},
					
			}
		},
		methods:{
			async getListData(){
				this.$emit('setFilterParams', this.filterObj)
					
			},
			setDaterange(val){
				// console.log(val)
				let startTime =  val ? val.slice(0,10)+ ' 00:00:00' :'',
						endTime = val ? val.slice(13, val.length) + ' 23:59:59' : '';
				this.filterObj.dateStart = startTime;
				this.filterObj.dateEnd = endTime;
			},
			goPage(name, parm={}, query={}){
				this.$router.push({
						name: name,
						params:parm,
						query:query,
				})
			},
		},
  }
</script>